package com.cskaoyan.bean.vo.search;

import com.cskaoyan.bean.MarketCategory;
import com.cskaoyan.bean.MarketGoods;
import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LC_RSH
 * @date 2022/6/28 23:32
 */
@Data
@NoArgsConstructor
public class SearchGoodsVO<T> {
    private Integer total;
    private Integer pages;
    private Integer limit;
    private Integer page;
    private List<T> list;
    private List<T> filterCategoryList;


    public static SearchGoodsVO data(PageInfo pageInfo, List<MarketCategory> filterCategoryList) {
        SearchGoodsVO data = new SearchGoodsVO();
        data.setTotal((int) pageInfo.getTotal());
        data.setPages(pageInfo.getPages());
        data.setPage(pageInfo.getPageNum());
        data.setLimit(pageInfo.getPageSize());
        data.setList(pageInfo.getList());
        data.setFilterCategoryList(filterCategoryList);
        return data;
    }
}

/**
 * @author 86157
 * @since 2022/06/28 23:32
 */